export class Common {
    secondFormat(sec,format='',has0=true){
        var hour = Math.floor(sec / 3600)
        var last = sec - hour * 3600
        var min = Math.floor(last / 60)
        var newsec = Math.floor(last) % 60
        var str = ''
        var ss = format.split(':')
        if((format.length == 0 && hour > 0) || ss.length == 3){
            str += has0? (hour >= 10 ? hour : '0'+hour) : hour
        }
        if(format.length == 0 || ss.length == 2){
            str.length && (str+=':')
            str += has0? (min >= 10 ? min : '0'+min) : min
        }
        str.length && (str+=':')
        str += has0? (newsec >= 10 ? newsec : '0'+newsec) : newsec
        return str
    }
}